package com.qyp.content.feignclient;

import com.qyp.configuration.openfeign.UserCenterFeignConfiguration;
import com.qyp.content.domain.dto.user.UserAddBonseDTO;
import com.qyp.content.domain.dto.user.UserDTO;
import com.qyp.content.feignclient.fallback.UserCenterFeignClientFallback;
import com.qyp.content.feignclient.fallbackfactory.UserCenterFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

//@FeignClient(name = "user-center", configuration = UserCenterFeignConfiguration.class,fallback = UserCenterFeignClientFallback.class)
@FeignClient(name = "user-center", configuration = UserCenterFeignConfiguration.class,fallbackFactory = UserCenterFeignClientFallbackFactory.class)
//@FeignClient(name = "user-center", configuration = UserCenterFeignConfiguration.class)
/**
 * FallbackFactory比Fallback功能更强大，可以拿到异常，他们两个是互斥的
 */
public interface UserCenterFeignClient {

    @GetMapping("/users/{id}")
    UserDTO findById(@PathVariable Integer id);

    @PutMapping("/users/add-bonus")
    UserDTO addBonus(@RequestBody UserAddBonseDTO userAddBonseDTO);
}
